#!/usr/bin/env bash

PREFIX=$(realpath $(cd "$(dirname "$0")"; pwd))

cd $PREFIX

adb root
adb push ~/.ssh/upad.pub /data/ubuntu/root/.ssh/authorized_keys
adb shell "chmod 700 /data/ubuntu/root/.ssh;chmod 644 /data/ubuntu/root/.ssh/authorized_keys"
adb shell "cp -af /dev/graphics/fb0 /data/ubuntu/dev/fb0"
adb shell "echo 'zh_CN.UTF-8 UTF-8' > /data/ubuntu/etc/locale.gen"
adb push ubuntu/init.sh /data/ubuntu

# 取消下行注释，运行 init.sh
# adb shell "/data/ubuntu/init.sh"

rsync -avzh ubuntu/ upad:/

adb shell "rm /data/ubuntu/init.sh"
